package com.youyou.fusheng2.View.Adapter;

import androidx.annotation.NonNull;
import androidx.annotation.Nullable;
import androidx.fragment.app.Fragment;
import androidx.fragment.app.FragmentManager;
import androidx.fragment.app.FragmentPagerAdapter;

import java.util.ArrayList;
import java.util.List;

/**
 * @name fusheng2
 * @class name：com.youyou.fusheng2.View.Adapter
 * @anthor 浮生 QQ:2567294605
 * @time 2020/8/27 03:13
 * @to
 */
public class ViewPagerAdapter extends FragmentPagerAdapter {

    private List<Fragment> fragments;
    private List<String> tetleLayoue;

    public ViewPagerAdapter(@NonNull FragmentManager fm, List<Fragment> fragments, List<String> tetleLayoue) {
        super(fm);
        this.fragments = fragments;
        this.tetleLayoue=tetleLayoue;
    }

    @NonNull
    @Override
    public Fragment getItem(int position) {
      return fragments.get(position);
    }

    @Override
    public int getCount() {
        return tetleLayoue.size();
    }

    @Nullable
    @Override
    public CharSequence getPageTitle(int position) {
        return tetleLayoue.get(position);
    }
}
